/**
 * nghilt
 * 2011/09/18
 */
package vn.nnn.shogi.quanco;

import java.awt.Rectangle;
import java.util.ArrayList;

import javax.swing.JApplet;

import vn.nnn.shogi.board.Board;

/**
 * 
 */
public class QuanXePhongCap extends QuanXe {

	public QuanXePhongCap( Rectangle toaDo, int color, boolean normalDirection, JApplet mainApplet ) {
		super( toaDo, color, normalDirection, mainApplet );	
	}
	
	@Override
	public boolean canMove( Board board, Rectangle destination,
			QuanCo foundedPiece, ArrayList<QuanCo> listQuanCo ) {
		
		// Di chuyen nhu quan Xe
		boolean canmove = super.canMove( board, destination, foundedPiece, listQuanCo );
		
		// Hoac di chuyen nhu quan Vua
		if( !canmove ) {
			QuanVua quanVua = new QuanVua( toaDo, color, normalDirection, getMainApplet() );
			canmove = quanVua.canMove( board, destination, foundedPiece, listQuanCo );
		}
		
		return canmove;
	}
	
	@Override
	public boolean canUpgrade() {
		return false;
	}

	/* (non-Javadoc)
	 * @see vn.nnn.shogi.quanco.QuanCo#upgrade(java.awt.Rectangle, java.util.ArrayList)
	 */
	@Override
	public void upgrade( Rectangle destination, ArrayList<QuanCo> listQuanCo ) {
		
	}

	/* (non-Javadoc)
	 * @see vn.nnn.shogi.quanco.QuanCo#canRelease(vn.nnn.shogi.board.Board, java.awt.Rectangle, java.util.ArrayList)
	 */
	@Override
	public boolean canRelease( Board board, Rectangle destination,
			ArrayList<QuanCo> listQuanCo ) {		
		return false;
	}
	
	@Override
	public QuanCo getQuanTruocKhiPhong() {
		return new QuanXe( toaDo, color, normalDirection, getMainApplet() );
	}
}
